﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Tuples;

namespace TuplesTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var t1 = Tuple.New(2, "foo", 2.0);
            Console.WriteLine(t1);

            var t2 = t1.Append(true);
            Console.WriteLine(t2);

            Console.WriteLine(t2.Element1);
            Console.WriteLine(t2[1]);
            Console.WriteLine(t2.ElementAt(2));
            Console.WriteLine(t2.Fourth);

            var t3 = Tuple.New(2, "foo");
            Console.WriteLine(t3.ToString("I have {0} {1}s"));

            var t4 = Tuple.New(1).Append(2).Append(3);
            t4.Tail.Tail.First = 5;
            Console.WriteLine(t4);

            //Tuple<string, Nullable<int>>[] scores = 
            //        { new Tuple<string, Nullable<int>>("Jack", 78),
            //          new Tuple<string, Nullable<int>>("Abbey", 92), 
            //          new Tuple<string, Nullable<int>>("Dave", 88),
            //          new Tuple<string, Nullable<int>>("Sam", 91), 
            //          new Tuple<string, Nullable<int>>("Ed", null),
            //          new Tuple<string, Nullable<int>>("Penelope", 82),
            //          new Tuple<string, Nullable<int>>("Linda", 99),
            //          new Tuple<string, Nullable<int>>("Judith", 84)};

            //Console.WriteLine("The values in unsorted order:");
            //foreach (Tuple<string, Nullable<int>> score in scores)
            //    Console.WriteLine(score.ToString());

            //Console.WriteLine();

            //Array.Sort(scores);

            //Console.WriteLine("The values in sorted order:");
            //foreach (Tuple<string, Nullable<int>> score in scores)
            //    Console.WriteLine(score.ToString());
        }
    }
}
